<template>
  <div class="ticket">
    <x-header>开票信息
      <div href="javascript:;" class="headerAdd" @click="bindHeaderAdd">
        <img src="../../assets/img/securityCheckImg/addHeader.png" alt="">
      </div>
    </x-header>
    <div class="ticketContent contractContent" v-for="(item, index) in dataList" :key="index" @click="ticketClick($event,item)">
      <div class="information-item">
        <div class="information-item-title">发票类型</div>
        <div class="information-item-answer">{{item.BILL_TYPE == '01'?'专票':'普票' }}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">增值税名</div>
        <div class="information-item-answer">{{item.VAT_NAME}}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">增值税号</div>
        <div class="information-item-answer">{{item.VAT_NO}}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">增值税银行</div>
        <div class="information-item-answer">{{item.BANK_CODE}}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">增值税账号</div>
        <div class="information-item-answer">{{item.VAT_ACCT}}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">注册地址</div>
        <div class="information-item-answer">{{item.REG_ADDR}}</div>
      </div>
      <div class="information-item">
        <div class="information-item-title">出票分类</div>
        <div class="information-item-answer">{{item.DRAW_BILL_TYPE == '01'?'纸质发票':'电子发票'}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { XHeader } from "vux";
import Vue from "vue";
import { sqlQuery } from "@/utils/sqlOperation";
export default {
  data() {
    return {
      dataList: [],
      CONS_NO: ""
    };
  },
  components: {
    XHeader
  },
  methods: {
    bindHeaderAdd() {
      if (this.dataList.length > 0) {
        this.$vux.toast.text('已存在开票信息')
        return
      } else {
        this.$router.push({
          path: "/ticketMaintain?CONS_NO=" + this.CONS_NO
        });
      }
    },
    callback(str, msg) {
      console.log(111111111, str, msg);
      switch (str) {
        case "change":
          Vue.set(this, "dataList", msg);
          break;
        case "noChange":
          Vue.set(this, "dataList", this.dataList.concat(msg));
          break;
        default:
          break;
      }
    },
    ticketClick(event, item) {
      this.$router.push({
        path: "/ticketMaintain?item=" + JSON.stringify(item) + "&change_type=2"
      });
    }
  },
  mounted() {
    Vue.set(this, "CONS_NO", localStorage.getItem("CONS_NO"));
    console.log(this.CONS_NO);
    sqlQuery(this.CONS_NO, "NOTE_INFO", this.callback);
    // const _this = this;
    // AndroidApi.queryTableData(
    //   '{"whereClause":"select * from NOTE_INFO","whereArgs":[]}',
    //   function(msg) {
    //     console.log(msg);
    //     Vue.set(_this, "dataList", msg.result);
    //   }
    // );
  }
};
</script>
<style scoped lang="less">
@import "../../assets/less/style.less";
</style>


